package com.lwm.base;

/**
 * @author liweimin
 * @date 2020/9/23 10:08
 * @description
 */
public class DiGui {
    public void hanoi(int n, String a, String b, String c) {
        if (n == 1)
            System.out.println(a + "--->" + c);
        else {
            hanoi(n - 1, a, c, b);
            hanoi(1, a, b, c);
            hanoi(n - 1, b, a, c);
        }
    }

    public int getResult(int i) {
        if (i == 1 || i == 0)
            return 1;
        else return i * getResult(i - 1);
    }

    public int F(int i) {
        if (i == 1)
            return 0;
        else if (i == 2)
            return 1;
        else return F(i - 1) + F(i - 2);
    }

    public static void main(String[] args) {
        System.out.println(new DiGui().getResult(23));
        System.out.println(new DiGui().F(23));
        new DiGui().hanoi(7,"A","B","C");
    }
}
